import os

file_dir = 'D:\Datasets\Face_Anti_Spoofing\Replay-Attack\protocols_csv\data_train.csv'
save_dir = 'D:\Datasets\Face_Anti_Spoofing\Replay-Attack\protocols_csv\data_train_adverse.csv'

b=[x for x in open(file_dir).readlines() if x.find('_adverse')>-1]
with open(save_dir,'w') as f:
    f.writelines(b)